<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui">

    <h:form id="ViaggioListForm">

        <p:panel header="#{myBundle.ListViaggioTitle} for #{context.ID}">
  
  
            <p:dataTable id="datalist" value="#{viaggioController.items}" var="item"
                         selectionMode="single" selection="#{viaggioController.selected}"
                         rowKey="#{item.idVIAGGIO}"
                         paginator="true"
                         rows="10"
                         rowsPerPageTemplate="10,20,30"
                         >

                <p:ajax event="rowSelect"   update="createButton inviteButton viewButton editButton deleteButton manageButton"/>
                <p:ajax event="rowUnselect" update="createButton inviteButton viewButton editButton deleteButton manageButton"/>

                <p:column sortBy="#{item.idVIAGGIO}" filterBy="#{item.idVIAGGIO}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListViaggioTitle_idVIAGGIO}"/>
                    </f:facet>
                    <h:outputText value="#{item.idVIAGGIO}"/>
                </p:column>
                <p:column sortBy="#{item.titolo}" filterBy="#{item.titolo}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListViaggioTitle_titolo}"/>
                    </f:facet>
                    <h:outputText value="#{item.titolo}"/>
                </p:column>
                <p:column sortBy="#{item.dataCreazione}" filterBy="#{item.dataCreazione}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListViaggioTitle_dataCreazione}"/>
                    </f:facet>
                    <h:outputText value="#{item.dataCreazione}">
                        <f:convertDateTime pattern="MM/dd/yyyy" />
                    </h:outputText>
                </p:column>
                <p:column sortBy="#{item.pagato}" filterBy="#{item.pagato}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListViaggioTitle_pagato}"/>
                    </f:facet>
                    <h:selectBooleanCheckbox id="pagato" value="#{item.pagato}" title="#{myBundle.EditViaggioTitle_pagato}" required="true" requiredMessage="#{myBundle.EditViaggioRequiredMessage_pagato}" disabled="true"/>
                </p:column>
                <f:facet name="footer">
                    <div class="footer-section">
                        <p:commandButton id="createButton" icon="ui-icon-plus"   value="#{myBundle.Create}" actionListener="#{viaggioController.prepareCreate}" update=":ViaggioCreateForm" oncomplete="ViaggioCreateDialog.show()"/>
                        <p:commandButton id="inviteButton" icon="ui-icon-plus"   value="Invite Friends" actionListener="#{prenotazioniController.prepareCreate}" update=":PrenotazioniCreateForm" oncomplete="PrenotazioniCreateDialog.show()"/>
                        <p:commandButton id="viewButton"   icon="ui-icon-search" value="#{myBundle.View}" update=":ViaggioViewForm" oncomplete="ViaggioViewDialog.show()" disabled="#{empty viaggioController.selected}"/>
                        <p:commandButton id="editButton"   icon="ui-icon-pencil" value="#{myBundle.Edit}" update=":ViaggioEditForm" oncomplete="ViaggioEditDialog.show()" disabled="#{empty viaggioController.selected}"/>
                        <p:commandButton id="deleteButton" icon="ui-icon-trash"  value="#{myBundle.Delete}" actionListener="#{viaggioController.delete}" update=":growl,datalist" disabled="#{empty viaggioController.selected}"/>
                        <p:commandButton id="manageButton" icon="ui-icon-edit"  actionListener="#{travelId.update}" value="Manage elements" action="/user/manageElements" disabled="#{empty viaggioController.selected}" >
                            <f:param name="idViaggio" value="#{viaggioController.selected.idVIAGGIO}" />
                        </p:commandButton>
                    </div>
                </f:facet>

            </p:dataTable>

        </p:panel>

    </h:form>

</ui:composition>